<template>
  <el-card class="box-card" :style="{ 'left': x + 'px', 'top': y + 'px' }" :stop="11" @click.stop="" style="padding: 0;">
    <div class="text item" @click.stop="callBack()" v-if="showForEdge">
          配置数据
    </div>
    <div class="text item" @click.stop="callBack('remove')">
      删除
    </div>
  </el-card>
</template>

<script>


export default {
  name: "MenuBar",
  data() {
    return {
      x: '',
      y: '',
      showForEdge: true,
      item: {}
    };
  },
  mounted() {

  },
  methods: {
    initFn(x, y, item) {
      this.x = parseInt(x) + ''
      this.y = y + ""
      if (item.type == 'edge') {
        let sourceId = item.item.source.cell;
        var node = this.$parent.getNodeById(sourceId)
        let nodeType = node.data.bpmnType;
        if (nodeType == 'exclusiveGateway' || nodeType == 'inclusiveGateway') {
          this.showForEdge = true;
        } else{
          this.showForEdge = false;
        }
      }
      if (item) {
        this.item = item
      }

    },
    setItem(item) {
      this.item = item
    },
    callBack(type) {
      if (type == 'remove') {
        this.$emit('callBack', type, this.item)
      } else {
        console.log('item ', this.item)
        this.$emit('callBack', this.item.item.data.bpmnType, this.item)
      }
    }
  }
};
</script>
<style scoped>
.box-card {
  position: absolute;
  z-index: 112;
}

.box-card ::v-deep .el-card__body {
  padding: 0;
}

.text {
  font-size: 14px;
}

.item {
  padding: 10px 0;
  text-align: center;
}

.item:hover {
  color: #ffffff;
  background-color: #409eff;
}

.box-card {
  width: 150px;
}
</style>
